package com.hczt.xhminiapp.db.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;

/**
 * @author 红创-马海强
 * @date 2019-03-13 14:38
 * @description
 */
@Data
@Entity
@Table(name = "t_sys_user")
public class SysUser implements Serializable {
    private static final long serialVersionUID = -5685258728984987970L;

    @Id
    @GenericGenerator(name = "idGenerator", strategy = "uuid")
    @GeneratedValue(generator = "idGenerator")
    @Column(name = "user_id", length = 40)
    private String  userId;

    private String  username;

    private String  password;

    private String  realName;

    private String  phoneNo;

    private String  headerImage;

    private String  salt;

    private String  sex;

    private Boolean enabled = true;

    private Boolean deleted = true;

    @Column(name = "create_time", updatable = false)
    private Date    createTime;
    @JsonIgnore
    @ManyToMany
    @JoinTable(name="t_sys_user_role",joinColumns=@JoinColumn(name="user_id"),
            inverseJoinColumns=@JoinColumn(name="role_id"))
    private List<SysRole> roleList = new LinkedList<>();

}
